<?php
include_once '../Login/databaseconnection.php';

if(!loggedin())
{
	require_once '../index.php';
}
   
   else
   {
   $Exam_Name=$_SESSION['Exam_Name'];
   $School_Id=$_SESSION['School_Id'];
	  $Year=$_SESSION['Year'];
   
	$School_Idc=$_POST['School_Idc'];
	$Exam_Namec=$_POST['Exam_Namec'];
    $Yearc=$_POST['Yearc'];
    $No_Of_Sat_Students=$_POST['No_Of_Sat_Students'];
    $No_Of_Passed_Students=$_POST['No_Of_Passed_Students'];
   
   if($School_Idc==""||$Exam_Namec==""||$Yearc==""||$No_Of_Sat_Students==""||$No_Of_Passed_Students=="")
	{
		   $_SESSION['errorin']="Please check your inputs!";
	 }
	else
	{
	
$sql=mysql_query("UPDATE exam SET School_Id='$School_Idc',Exam_Name='$Exam_Namec',Year='$Yearc',No_Of_Sat_Students='$No_Of_Sat_Students',No_Of_Passed_Students='$No_Of_Passed_Students' WHERE School_Id='$School_Id' AND Exam_Name='$Exam_Name' AND Year='$Year'");

 if(mysql_affected_rows()!=0)
  {
$_SESSION['error']="This record is successfully updated!";
  }
  if(mysql_affected_rows()==0)
  {
 $_SESSION['error']="Sorry unable to update this record!";
  }
	
}
}
  ?>

